// import vueJsx from '@vitejs/plugin-vue-jsx';

import { fileURLToPath, URL } from 'node:url'
import WindiCSS from 'vite-plugin-windicss'
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import path from "path"
// import copy from 'vite-plugin-copy'; 
import { viteStaticCopy } from 'vite-plugin-static-copy';

// https://vitejs.dev/config/
export default defineConfig({  
  plugins: [
    vue(),WindiCSS(),
    viteStaticCopy({
      targets: [
        { src: 'src/assets/SpaceCaptain.zip', dest: 'dist' }
      ]
    })
  ],
  resolve: {
    alias: {
      '@': fileURLToPath(new URL('./src', import.meta.url)),
      '~':path.resolve(__dirname,"src")
    }
  },
  server:{
    proxy:{
      '/api':{
        target:'http://127.0.0.1:8001',
        // target:'http://121.196.211.16:8001',


        changeOrigin:true,
        rewrite:(path)=>path.replace(/^\/api/,'')
        // rewrite: (path) => path // 不需要重写路径，直接转发
      }
    }
  }
})
